// import BaseUIMediator from "../../LTGame/UIExt/FGui/BaseUIMediator";
import BaseUIMediator from "../../LTGame/UI/BaseUIMediator";
import UI_Main from "../../ui/Main/UI_Main";
import Awaiters from "../../LTGame/Async/Awaiters";
import { DebuggerManager } from "../debugger/DebuggerManager";
import UI_ChooseClientMediator from "./UI_ChooseClientMediator";

export default class UI_MainMediator extends BaseUIMediator<UI_Main> {

    private static _instance: UI_MainMediator;
    public static get instance(): UI_MainMediator {
        if (this._instance == null) {
            this._instance = new UI_MainMediator();
            this._instance._classDefine = UI_Main;
        }
        return this._instance;
    }

    _OnPreShow() {
        this._uiData.isFullScreen = true;
    }

    _OnShow() {
        super._OnShow();
        // your code

        this._WaitConnection();
    }

    private async _WaitConnection() {
        while (true) {
            await Awaiters.NextFrame();
            if (DebuggerManager.instance.isReady) {
                break;
            }
        }

        UI_ChooseClientMediator.instance.Show();
    }

}